<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/topLess.jsp"%>
<script>document.title="发展指数计算说明";</script>
<script src="${baseURL}/static/js/jquery.easyui.min.js"></script>
<link href="${baseURL}/static/js/themes/default/easyui.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
table {
	margin:0;
	width:0;
	font-family:"微软雅黑";
	font-size:12px;
	color: #FFF;
	border-collapse: collapse;
}
//-->
</style>
<div id="context">
<table id="search_t" style="width:98%">
		<tbody>
			<tr>
				<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png" align="middle">&nbsp;计算说明
				</th>
			</tr>
		</tbody>
</table>
<div id="dataList" style="overflow:auto;width:98%;height:400px">
<table id="dg" fit="true"></table>
</div>
<script language="javaScript">

	var area_id = '320000000000000';
	
	var yearUrl = "${baseURL}/calculateExplain/developmentIndexYearList/"+area_id;
	
	var col = [[
		        {title:'指标名称',field:'di_name',width:380},  
		        {title:'指标权重',field:'di_weight',width:60,align:'right'},    
		        {title:'指标类型',field:'di_type',width:80},
		        {title:'指标来源',field:'indicator_type',width:80}
		        ]];
	
	var yearArray = new Array();

	$(function(){
		$.ajax({
			url: yearUrl,
			dataType:"json",
			success: function(data){	
				$.each(data, function(i, obj){
					col[0].push({title:obj.year+'年',field:'year'+obj.year,width:80, align:'center'});
					yearArray.push(obj.year);
				});
				
				initTreeData();	//初始化数据表
			},
			error: function(data){
				
			}
		});
		
		

	});
	
	function initTreeData(){
	
		$('#dg').treegrid({
			url:'${baseURL}/calculateExplain/developmentIndex/0/'+area_id, 
		    idField:'id',
		    treeField:'di_name',
		    parentField: 'di_parent',
		    width: 'auto',
		    height:'400',
		    columns:col,
		    onBeforeLoad: function(row,param){
		    	if (row){
		    		$(this).treegrid('options').url = "${baseURL}/calculateExplain/developmentIndex/"+row.id+"/"+area_id;
		    	}
		    },
		    loadFilter: function(data, parentId){
		    	$.each(data, function(i, obj){
		    		if (obj.di_type=='1'){
		    			obj.di_type = '正向指标';
		    		}
		    		if (obj.di_type=='0'){
		    			obj.di_type = '<font color=red>逆向指标</font>';
		    		}
		    		
		    		if (obj.indicator_type == '5'){
		    			obj.indicator_type = "核算指标";
		    			
		    			for (var i = 0; i<yearArray.length; i++){
		    				var year = yearArray[i];
		    				var accId = obj['accId'+year];
		    				
		    				obj['year'+year] = "<a href='#' onclick='showIndicatorProcess(\"" + accId + "\", " + year + ")'>"+obj['year'+year]+"</a>"
		    				//alert(obj['accId'+yearArray[i]]);
		    			}
		    			
		    		}else if (obj.indicator_type == '4'){
		    			obj.indicator_type = '录入指标';		    			
		    		}
		    		
		    	});
		    	return data;
		    }   
		});
		
	}

	function showIndicatorList(id, name){
		var url = '${baseURL}/calculateExplain/showIndicatorList/'+id+'/'+area_id;
		openWin(name, url, 600,  500);
	}
	function showIndicatorProcess(id, year){
		var url = '${baseURL}/audit/indicatorProcess/'+id;
		openWin(year+"年", url, $(parent.window).width(), $(parent.window).height()-50);
	}
	
</script>




<%@ include file="/static/include/bottom.jsp"%>